$(function () {
        hljs.highlightAll();
        $("#comment-btn").on("click",function () {
                var $this=$(this);
                var user_id=$this.attr("data-user-id");
                if(!user_id || user_id==""){
                        alert("请先登录");
                        window.location='/login/';
                }
                var post_id=$this.attr("data-post-id");
                var content=$("#comment-textarea").val();
                zlajax.post({
                        url:'/post/comment/',
                        data:{
                                post_id,content
                        },
                        success:function (result) {
                                if(result['code']==200){
                                        alert("评论成功!");
                                        window.location.reload();
                                }else{
                                        alert(result['message']);
                                }
                        }
                })

        })
})